namespace SubSonic
{
    using SubSonic.Utilities;
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class DBCollection : List<DB>
    {
        public DB this[string dbName]
        {
            get
            {
                foreach (DB db in this)
                {
                    if (Utility.IsMatch(db.ProviderName, dbName))
                    {
                        return db;
                    }
                }
                return null;
            }
            set
            {
                for (int i = 0; i < base.Count; i++)
                {
                    if (Utility.IsMatch(base[i].ProviderName, dbName))
                    {
                        base[i] = value;
                        return;
                    }
                }
            }
        }
    }
}

